package com.example.algorithm.huawei_rongyao_29;

import java.util.Scanner;

// 折纸问题
// 难度：简单

public class Q08_PaperFolding02 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        printAllFolds(n);
        scanner.close();
    }

    public static void printAllFolds(int n) {
        printProcess(1, n, true);
    }

    // 递归方式类似中序遍历树的方式来打印折痕类型
    public static void printProcess(int i, int n, boolean isDown) {
        // 相比于Q08_PaperFolding02的另一种写法
        if (i <= n) {
            printProcess(i + 1, n, true);
            System.out.println(isDown ? "down" : "up");
            printProcess(i + 1, n, false);
        }
    }
}



